package com.easyfun.healthmagicbox.comm.json;

import org.json.JSONException;
import org.json.JSONObject;

import com.easyfun.healthmagicbox.pojo.HConfiguration;
import com.easyfun.healthmagicbox.pojo.HealthInputData;

public class HConfigurationJsonWrapper <T extends JsonWrapper,E> 
	extends AbstractJsonWrapper<T,HConfiguration>{
	public HConfigurationJsonWrapper(HConfiguration pp)
	{
		super(pp);
	}

	public HConfigurationJsonWrapper()
	{
		
	}
 
    public void deserializeFromObj(JSONObject obj) throws JSONException {

    	if (mpp==null)
    		mpp = new HConfiguration();
    	
    	mpp.setAccess_KEY_name(obj.getString("access_KEY_name"));
    	mpp.setAccess_SECRET_name(obj.getString("access_SECRET_name"));
    	mpp.setAccess_UID_name(obj.getString("access_UID_name"));
    	mpp.setAccess_AUTH_TYPE_name(obj.getString("access_AUTH_TYPE_name"));
    	mpp.setApp_key(obj.getString("app_key"));
    	mpp.setApp_secret(obj.getString("app_secret"));
    	mpp.setSyncInterval(obj.getString("syncInterval"));
    	
    }
 
    
 
    public JSONObject serializeToObj() throws JSONException {
        JSONObject serializedObj = new JSONObject();
        serializedObj.put("access_KEY_name", mpp.getAccess_KEY_name());
        serializedObj.put("access_SECRET_name", mpp.getAccess_SECRET_name());
        serializedObj.put("access_UID_name", mpp.getAccess_UID_name());
        serializedObj.put("access_AUTH_TYPE_name", mpp.getAccess_AUTH_TYPE_name());
        serializedObj.put("app_key", mpp.getApp_key());
        serializedObj.put("app_secret", mpp.getApp_secret());
        serializedObj.put("syncInterval", mpp.getSyncInterval());
 
        return serializedObj;
    }
}
